package main;


import plugins.IPlugin;

import settings.Settings;
import settings.Settingsview;

/**
 * This is the main controller of the app. It is responsible for loading the main data and
 * creating the appropriate view
 * 
 * @author daishy
 * @date 23.03.2008 15:51:55
 *
 */
public class Maincontroller 
{
	/**
	 * Settings for the application
	 */
	private Settings settings;
	
	/**
	 * The model of this controller
	 */
	private Mainmodel model;
	
	/**
	 * The view associated with this controller
	 */
	private Mainview view;
	
	/**
	 * CTor, loading the settings (filename "settings.xml")
	 */
	public Maincontroller()
	{		
		

		// creating the 
		this.model = new Mainmodel();
		this.view = new Mainview(this);
	}
	
	
	/**
	 * This method will open a new settingsdialog and 
	 * attach all known plugins to it	 
	 */
	public void showSettings()
	{
		Settingsview view = new Settingsview(this.view);
	
		// adding each panel loaded
		for(IPlugin plugin : model.getLoadedPlugins())
			view.addPlugin(plugin.getPluginname(), plugin.getSettingsPanel());
		
		// display the Dialog
		view.display(true);		
	}
}
